# models.py
from django.db import models

# 类名代表了数据库表名，且继承了models.Model，类里面的字段代表数据表中的字段(name)，数据类型则由CharField（相当于varchar）、DateField（相当于datetime）， max_length 参数限定长度。
class Test(models.Model):
    name = models.CharField(max_length=20)


# 用户表
class User(models.Model):
    user_name = models.CharField(max_length=20)
    user_sex = models.CharField(max_length=3)
    user_age = models.CharField(max_length=3)
    user_phone = models.CharField(max_length=11)
    user_nick = models.CharField(max_length=20)
    user_pwd = models.CharField(max_length=16)


class Grade(models.Model):
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    grade = models.IntegerField()

